﻿using Frame.Core.IServices.Admin;
using Frame.Core.Models;
using Frame.Core.Repository;
using System.Threading.Tasks;

namespace Frame.Core.Services.Admin
{
    public class RoleService : BaseService<Roles>, IRoleService
    {

        IRepositoryBase<Roles> _dal;
        IRepositoryBase<RoleUsers> _roleUserRepository;
        public RoleService(IRepositoryBase<Roles> dal,IRepositoryBase<RoleUsers> roleUserRepository)
        {
            this._dal = dal;
            base.BaseDal = dal;
            _roleUserRepository = roleUserRepository;
        }
        public async Task<long> GetRoleUsersCountById(int roleID)
        {
            return await _roleUserRepository.Select.Where(a => a.RoleID == roleID).CountAsync();
        }
    }
}
